Take into account that OpenL Maven Plugin expects the following directory structure:
|- your-project/ Project root folder | |- pom.xml Maven project file | | | |- src/ | | | | |- main/ | | | | | | |- java/ Contains java sources | | | | | | | |- resources/ Contains java resources | | | | | | | |- openl/ Contains all OpenL-related resources (rules, xml etc.) | | | | | | | | | | | | |- rules.xml OpenL project descriptor (for OpenL only) | | | | |- rules/ | | | | | |- TemplateRules.xls File with rules
Note that OpenL-related resources are located in the src/main/openl directory. But it can be changed to fit user's needs by changing the sourceDirectory parameter in maven plugin configuration.
Note: It is not recommended to put OpenL-related resources to the src/main/resources folder. In this case, OpenL resources will be inside the JAR file alongside with the compiled Java classes - most probably not what was expected to do in production.
The simplest way to create OpenL artifact:
<packaging>openl</packaging>
[...]
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>org.openl.rules</groupId>
<artifactId>openl-maven-plugin</artifactId>
<version>${org.openl.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
[...]
</build>
In this case, the OpenL project will be processed trough Maven lifecycle:
The simplest way to generate interface for rules defined in the TemplateRules.xls file:
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>org.openl.rules</groupId>
<artifactId>openl-maven-plugin</artifactId>
<version>${org.openl.version}</version>
<configuration>
<interfaceClass>org.company.gen.TemplateRulesInterface</interfaceClass>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
[...]
</build>
In this case, classes are generated on each Maven run during the generate-sources phase.
To invoke class generation manually, remove the executions node and run in the console when needed:
mvn openl:generate
More configuration options can be found on the openl:generate goal page.
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>org.openl.rules</groupId>
<artifactId>openl-maven-plugin</artifactId>
<version>${org.openl.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
[...]
</build>
More configuration options can be found on the openl:compile goal page.
The simplest way to invoke OpenL Tablets Test:
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>org.openl.rules</groupId>
<artifactId>openl-maven-plugin</artifactId>
<version>${org.openl.version}</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
[...]
</build>
More configuration options can be found on the openl:test goal page.